package com.ghxxzx.dagl.controller;

import com.ghxxzx.dagl.vo.ResultEntity;
import com.sun.org.apache.bcel.internal.generic.RETURN;
import org.apache.tomcat.util.http.fileupload.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream;
import java.io.IOException;

/**
 * desc:
 *
 * @author cx316
 * Created by cx316 on 2020-06-03.
 */
@RestController
public class FlfgController {
    Logger log = LoggerFactory.getLogger(getClass());
    @RequestMapping("/getFlfgPDF")
    public void getFlfgPDF(HttpServletResponse response) throws Exception{
        FileInputStream inputStream=null;
        ServletOutputStream out = null;
        try {
            inputStream = new FileInputStream("C:\\Users\\cx316\\Desktop\\Git的GUI使用说明.pdf");
            out = response.getOutputStream();
            IOUtils.copy(inputStream,out);
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if (inputStream != null) {
                try {
                    inputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            if (out != null) {
                try {
                    out.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

}
